sort a list using a custom function with multiple parameters